home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 037a / plx13.zip / WFPLUS.PAS < prev    next >
Pascal/Delphi Source File  |  1991-10-13  |  3KB  |  134 lines

  1. {WFPLUS - Function Extensions to ObjectWindows Copyright (C) Doug Overmyer 7/1/91}
  2. unit WFPlus;
  3.  
  4.  
  5. {******************************************************************}
  6. { I N T E R F A C E                                                        }
  7. {******************************************************************}
  8. interface
  9. uses WinTypes, WinProcs, WinDos, Strings, WObjects,StdDlgs;
  10. function Max(I,J:Integer):Integer;
  11. function Min(I,J:Integer):Integer;
  12. function GetDateTime(szDateTime:PChar):Boolean;
  13. function ExpandTabs(InStr,OutStr:PChar;Tabsize:Integer):Boolean;
  14. function CheckCC(InStr,OutStr:PChar):Boolean;
  15. {********************************************************************}
  16. {I M P L E M E N T A T I O N                                                     }
  17. {********************************************************************}
  18. implementation
  19.  
  20. {***********************************************************************}
  21. function Max(I,J:Integer):Integer;
  22. begin
  23.     if I > J then
  24.         Max := I
  25.     else
  26.         Max := J;
  27. end;
  28. {***********************************************************************}
  29. function Min(I,J:Integer):Integer;
  30. begin
  31.     if I < J then
  32.        Min := I
  33.   else
  34.        Min := J;
  35. end;
  36.  
  37. function  GetDateTime(szDateTime:PChar):Boolean;
  38. var
  39.   m,d,y,dw: Word;
  40.   temp,tag: string[4];
  41.   tStr: String;
  42. Begin
  43.   tStr := '';
  44.   GetTime(y,m,d,dw);
  45.   if (y > 12) then begin
  46.     y := (y - 12);
  47.     tag := 'pm';
  48.   End else
  49.     tag := 'am';
  50.   str(y,temp);
  51.   if (y < 10) then
  52.     temp := '0' + Temp;
  53.   tStr := tStr + temp + ':';
  54.   str(m,Temp);
  55.   tStr := tStr + temp + ':';
  56.   str(d,temp);
  57.   tStr := tStr + temp + tag + '     ';
  58.   GetDate(y,m,d,dw);
  59.   str(m,Temp);
  60.   if (m < 10) then
  61.     temp := '0' + temp;
  62.   tStr := tStr + temp + '/';
  63.   str(d,Temp);
  64.   if (d < 10) then
  65.     Temp := '0' + temp;
  66.   tStr := tStr + Temp + '/';
  67.   str(y,temp);
  68.   tStr := tStr + temp;
  69.   strPcopy(szDateTime,tStr);
  70.   GetDateTime := True;
  71. End;
  72.  
  73. function ExpandTabs(InStr,OutStr:PChar;Tabsize:Integer):Boolean;
  74. var
  75.     IndxIn,IndxOut,IndxTab:Integer;
  76.    NextTab:Integer;
  77. begin
  78.     IndxIn := 0;IndxOut:= 0;IndxTab:= 0;
  79.   For IndxIn := 0 to (StrLen(InStr) -1) do
  80.     case InStr[IndxIn] of
  81.         #9:
  82.           begin
  83.           NextTab := ((IndxOut div TabSize) +1) * TabSize;
  84.         for IndxTab := 1 to (NextTab - IndxOut) do
  85.             begin
  86.           OutStr[IndxOut] := #32;
  87.           Inc(IndxOut);
  88.           end;
  89.         end;
  90.       #0..#31:
  91.           begin
  92.         OutStr[IndxOut] := #32;
  93.         Inc(IndxOut);
  94.         end;
  95.       else
  96.           begin
  97.         OutStr[IndxOut] := InStr[IndxIn];
  98.         Inc(IndxOut);
  99.         end;
  100.     end;
  101.   OutStr[IndxOut] := #0;
  102.   ExpandTabs := TRUE;
  103. end;
  104.  
  105. function CheckCC(InStr,OutStr:PChar):Boolean;
  106. var
  107.     IndxIn,IndxOut:Integer;
  108. begin
  109.     IndxIn := 0;IndxOut:= 0;
  110.   For IndxIn := 0 to (StrLen(InStr) -1) do
  111.     case InStr[IndxIn] of
  112.         #9:                             {retain tabs}
  113.         begin
  114.         OutStr[IndxOut] := #9;
  115.         Inc(IndxOut);
  116.         end;
  117.       #0..#31:
  118.           begin
  119.         OutStr[IndxOut] := #32;
  120.         Inc(IndxOut);
  121.         end;
  122.       else
  123.           begin
  124.         OutStr[IndxOut] := InStr[IndxIn];
  125.         Inc(IndxOut);
  126.         end;
  127.     end;
  128.   OutStr[IndxOut] := #0;
  129.   CheckCC := TRUE;
  130. end;
  131.  
  132.  
  133. end.
  134.